/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package data.impl;

import data.DataPackage;
import data.DisplacementSample;
import data.FusedDataSample;
import data.HeartRateSample;
import data.PositionSample;
import data.TemperatureSample;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Fused Data Sample</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link data.impl.FusedDataSampleImpl#getDisplacementsample <em>Displacementsample</em>}</li>
 *   <li>{@link data.impl.FusedDataSampleImpl#getHeartratesample <em>Heartratesample</em>}</li>
 *   <li>{@link data.impl.FusedDataSampleImpl#getPositionsample <em>Positionsample</em>}</li>
 *   <li>{@link data.impl.FusedDataSampleImpl#getTemperaturesample <em>Temperaturesample</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class FusedDataSampleImpl extends DataSampleImpl implements FusedDataSample {
	/**
	 * The cached value of the '{@link #getDisplacementsample() <em>Displacementsample</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDisplacementsample()
	 * @generated
	 * @ordered
	 */
	protected DisplacementSample displacementsample;

	/**
	 * The cached value of the '{@link #getHeartratesample() <em>Heartratesample</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getHeartratesample()
	 * @generated
	 * @ordered
	 */
	protected HeartRateSample heartratesample;

	/**
	 * The cached value of the '{@link #getPositionsample() <em>Positionsample</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPositionsample()
	 * @generated
	 * @ordered
	 */
	protected PositionSample positionsample;

	/**
	 * The cached value of the '{@link #getTemperaturesample() <em>Temperaturesample</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTemperaturesample()
	 * @generated
	 * @ordered
	 */
	protected TemperatureSample temperaturesample;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected FusedDataSampleImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return DataPackage.Literals.FUSED_DATA_SAMPLE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DisplacementSample getDisplacementsample() {
		return displacementsample;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetDisplacementsample(DisplacementSample newDisplacementsample, NotificationChain msgs) {
		DisplacementSample oldDisplacementsample = displacementsample;
		displacementsample = newDisplacementsample;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DataPackage.FUSED_DATA_SAMPLE__DISPLACEMENTSAMPLE, oldDisplacementsample, newDisplacementsample);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDisplacementsample(DisplacementSample newDisplacementsample) {
		if (newDisplacementsample != displacementsample) {
			NotificationChain msgs = null;
			if (displacementsample != null)
				msgs = ((InternalEObject)displacementsample).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DataPackage.FUSED_DATA_SAMPLE__DISPLACEMENTSAMPLE, null, msgs);
			if (newDisplacementsample != null)
				msgs = ((InternalEObject)newDisplacementsample).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DataPackage.FUSED_DATA_SAMPLE__DISPLACEMENTSAMPLE, null, msgs);
			msgs = basicSetDisplacementsample(newDisplacementsample, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DataPackage.FUSED_DATA_SAMPLE__DISPLACEMENTSAMPLE, newDisplacementsample, newDisplacementsample));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public HeartRateSample getHeartratesample() {
		return heartratesample;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetHeartratesample(HeartRateSample newHeartratesample, NotificationChain msgs) {
		HeartRateSample oldHeartratesample = heartratesample;
		heartratesample = newHeartratesample;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DataPackage.FUSED_DATA_SAMPLE__HEARTRATESAMPLE, oldHeartratesample, newHeartratesample);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setHeartratesample(HeartRateSample newHeartratesample) {
		if (newHeartratesample != heartratesample) {
			NotificationChain msgs = null;
			if (heartratesample != null)
				msgs = ((InternalEObject)heartratesample).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DataPackage.FUSED_DATA_SAMPLE__HEARTRATESAMPLE, null, msgs);
			if (newHeartratesample != null)
				msgs = ((InternalEObject)newHeartratesample).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DataPackage.FUSED_DATA_SAMPLE__HEARTRATESAMPLE, null, msgs);
			msgs = basicSetHeartratesample(newHeartratesample, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DataPackage.FUSED_DATA_SAMPLE__HEARTRATESAMPLE, newHeartratesample, newHeartratesample));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PositionSample getPositionsample() {
		return positionsample;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetPositionsample(PositionSample newPositionsample, NotificationChain msgs) {
		PositionSample oldPositionsample = positionsample;
		positionsample = newPositionsample;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DataPackage.FUSED_DATA_SAMPLE__POSITIONSAMPLE, oldPositionsample, newPositionsample);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPositionsample(PositionSample newPositionsample) {
		if (newPositionsample != positionsample) {
			NotificationChain msgs = null;
			if (positionsample != null)
				msgs = ((InternalEObject)positionsample).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DataPackage.FUSED_DATA_SAMPLE__POSITIONSAMPLE, null, msgs);
			if (newPositionsample != null)
				msgs = ((InternalEObject)newPositionsample).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DataPackage.FUSED_DATA_SAMPLE__POSITIONSAMPLE, null, msgs);
			msgs = basicSetPositionsample(newPositionsample, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DataPackage.FUSED_DATA_SAMPLE__POSITIONSAMPLE, newPositionsample, newPositionsample));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TemperatureSample getTemperaturesample() {
		return temperaturesample;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetTemperaturesample(TemperatureSample newTemperaturesample, NotificationChain msgs) {
		TemperatureSample oldTemperaturesample = temperaturesample;
		temperaturesample = newTemperaturesample;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DataPackage.FUSED_DATA_SAMPLE__TEMPERATURESAMPLE, oldTemperaturesample, newTemperaturesample);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTemperaturesample(TemperatureSample newTemperaturesample) {
		if (newTemperaturesample != temperaturesample) {
			NotificationChain msgs = null;
			if (temperaturesample != null)
				msgs = ((InternalEObject)temperaturesample).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DataPackage.FUSED_DATA_SAMPLE__TEMPERATURESAMPLE, null, msgs);
			if (newTemperaturesample != null)
				msgs = ((InternalEObject)newTemperaturesample).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DataPackage.FUSED_DATA_SAMPLE__TEMPERATURESAMPLE, null, msgs);
			msgs = basicSetTemperaturesample(newTemperaturesample, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DataPackage.FUSED_DATA_SAMPLE__TEMPERATURESAMPLE, newTemperaturesample, newTemperaturesample));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case DataPackage.FUSED_DATA_SAMPLE__DISPLACEMENTSAMPLE:
				return basicSetDisplacementsample(null, msgs);
			case DataPackage.FUSED_DATA_SAMPLE__HEARTRATESAMPLE:
				return basicSetHeartratesample(null, msgs);
			case DataPackage.FUSED_DATA_SAMPLE__POSITIONSAMPLE:
				return basicSetPositionsample(null, msgs);
			case DataPackage.FUSED_DATA_SAMPLE__TEMPERATURESAMPLE:
				return basicSetTemperaturesample(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case DataPackage.FUSED_DATA_SAMPLE__DISPLACEMENTSAMPLE:
				return getDisplacementsample();
			case DataPackage.FUSED_DATA_SAMPLE__HEARTRATESAMPLE:
				return getHeartratesample();
			case DataPackage.FUSED_DATA_SAMPLE__POSITIONSAMPLE:
				return getPositionsample();
			case DataPackage.FUSED_DATA_SAMPLE__TEMPERATURESAMPLE:
				return getTemperaturesample();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case DataPackage.FUSED_DATA_SAMPLE__DISPLACEMENTSAMPLE:
				setDisplacementsample((DisplacementSample)newValue);
				return;
			case DataPackage.FUSED_DATA_SAMPLE__HEARTRATESAMPLE:
				setHeartratesample((HeartRateSample)newValue);
				return;
			case DataPackage.FUSED_DATA_SAMPLE__POSITIONSAMPLE:
				setPositionsample((PositionSample)newValue);
				return;
			case DataPackage.FUSED_DATA_SAMPLE__TEMPERATURESAMPLE:
				setTemperaturesample((TemperatureSample)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case DataPackage.FUSED_DATA_SAMPLE__DISPLACEMENTSAMPLE:
				setDisplacementsample((DisplacementSample)null);
				return;
			case DataPackage.FUSED_DATA_SAMPLE__HEARTRATESAMPLE:
				setHeartratesample((HeartRateSample)null);
				return;
			case DataPackage.FUSED_DATA_SAMPLE__POSITIONSAMPLE:
				setPositionsample((PositionSample)null);
				return;
			case DataPackage.FUSED_DATA_SAMPLE__TEMPERATURESAMPLE:
				setTemperaturesample((TemperatureSample)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case DataPackage.FUSED_DATA_SAMPLE__DISPLACEMENTSAMPLE:
				return displacementsample != null;
			case DataPackage.FUSED_DATA_SAMPLE__HEARTRATESAMPLE:
				return heartratesample != null;
			case DataPackage.FUSED_DATA_SAMPLE__POSITIONSAMPLE:
				return positionsample != null;
			case DataPackage.FUSED_DATA_SAMPLE__TEMPERATURESAMPLE:
				return temperaturesample != null;
		}
		return super.eIsSet(featureID);
	}

} //FusedDataSampleImpl
